<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>
<%--
  Created by IntelliJ IDEA.
  User: gz
  Date: 2025/03/22
  Time: 11:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script type="text/javascript" src="./script/jquery-3.7.1.min.js"></script>
    <script type="text/javascript">
        $(function (){
            $("#deleteBook").click(function (){
                // alert("ok")
                $("#hiddenForm").attr("action",this.href);
                $(":hidden").val("DELETE");
                $("#hiddenForm").submit();
                return false; //改变超链接的行为，不再提交
            })
        })
    </script>
</head>
<body>
<%--1.get和post请求方式与之前一样--%>
<h3>rest风格的url 删除书籍</h3>
<a href="vote/vote01/600" id="deleteBook">点击删除指定id=600的书</a>
<form action="" method="post" id="hiddenForm">
    <input type="hidden" name="_method" >
</form>
<br>

<h3>rest风格的url 修改书籍</h3>
<form action="vote/vote01/600" method="post"  >
    <input type="hidden" name="_method" value="PUT">
    <input type="submit" value="修改书籍">
</form>
<br>
</body>
</html>
